#include <assert.h>
#include <stack>
using namespace std;

class Solution
{
public:
    void push(int node) {
        stack1.push(node);
    }

    int pop() {
        if(stack2.empty())
        {
            while(!stack1.empty())
            {
                stack2.push(stack1.top());
                stack1.pop();
            }
        }
        int ret = 0;
        if(!stack2.empty())
        {
            ret = stack2.top();
            stack2.pop();
        }
        return ret;
    }

private:
    stack<int> stack1;
    stack<int> stack2;
};

int main()
{
    // 普通测试 连续多次push和连续多次pop
    Solution s;
    s.push(1);
    s.push(2);
    int r = s.pop();
    assert(r == 1);
    r = s.pop();
    assert(r == 2);
    r = s.pop();
    assert(r == 0);

    // push and pop
    s.push(3);
    r = s.pop();
    assert(r == 3);

    // no push
    Solution s2;
    r = s2.pop();
    assert(r == 0);

    return 0;
}